package com.biscuit.page.basicservice.persistence.dao;

import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.biscuit.page.basicservice.model.entities.mysql.SysNoteMessage;
import com.biscuit.page.basicservice.model.entities.mysql.SysUserDetail;
import com.biscuit.page.basicservice.persistence.mapper.NoteMessageMapper;
import com.biscuit.page.basicservice.utils.WrapperUtil;
import org.springframework.stereotype.Component;

/**
 * @author biscuit
 * @createTime 2024/6/11 10:07
 */
@Component
public class NoteMessageDao extends ServiceImpl<NoteMessageMapper, SysNoteMessage> {

    public void insertAndIncrement(SysNoteMessage sysNoteMessage) {
        baseMapper.insertAndIncrement(sysNoteMessage);
    }

    public void updateResultById(Long id, Integer isSuccess, String result) {
        LambdaUpdateWrapper<SysNoteMessage> updateWrapper = WrapperUtil.instanceUpdate(SysNoteMessage.class)
                .eq(SysNoteMessage::getId, id)
                .set(SysNoteMessage::getIsSucceed, isSuccess)
                .set(SysNoteMessage::getResult, result);
        super.update(updateWrapper);
    }

}
